import java.util.ArrayList;

public class Problem4 {
	public static void main(String[] args) {
		int product = 1;
		int max_value = 0;
		ArrayList<Integer> arr = new ArrayList<Integer>();
		for (int i = 999; i >= 100; i --) {
			for (int j = i; j >= 100; j --) {
				product = i*j;
				if (isPalindrome(product)) {
					if(max_value <= product) {
						max_value = product;
						arr.add(product);
					} else {
						break;
					}
				}
			}
		}
		for(int k : arr){
		System.out.println(""+k);
		}
	}

	private static boolean isPalindrome(int p) {
		String s = "" + p;
		String t = new StringBuffer(s).reverse().toString();
		if (s.equals(t))
			return true;
		return false;
	}
}
